// pages/booking-history/booking-history.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    scrollHeight:'',
    toView: 'red',
    scrollTop: 100,
    bookingStatus:'',
    showbookingStatus: [],
    eleList: [
      {
        src: 'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
        name: '天文直播间',
        time: '2018 - 03 - 22 22: 30',
        status: 0
      },
      {
        src: 'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
        name: '天文直播间',
        time: '2018 - 03 - 22 22: 30',
        status: 1
      },
      {
        src: 'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
        name: '天文直播间',
        time: '2018 - 03 - 22 22: 30',
        status: 2
      },
      {
        src: 'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
        name: '天文直播间',
        time: '2018 - 03 - 22 22: 30',
        status: 3
      }
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this ;
    var scrollHeight = wx.getSystemInfoSync().windowHeight;
    that.setData({
      scrollHeight:scrollHeight
    })
  },

  turnTo:function(){
    wx.navigateTo({
      url: '../../pages/order-history/order-history'
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    // var that = this;
    // var eleList = that.data.eleList;
 
    // eleList.forEach(function (e) {
     
    //   if(e.status == 0) {
    //     that.setData({
    //       bookingStatus: '预约中'
    //     })
    //     that.data.showbookingStatus.push(that.data.bookingStatus)
    //   } else if(e.status == 1) {
    //     that.setData({
    //       bookingStatus: '预约成功'
    //     })
    //     that.data.showbookingStatus.push(that.data.bookingStatus)
    //   } else if(e.status == 2) {
    //     that.setData({
    //       bookingStatus: '预约已完成'
    //     })
    //     that.data.showbookingStatus.push(that.data.bookingStatus)
    //   }
    //   else {
    //     that.setData({
    //       bookingStatus: '预约失败'
    //     })
    //     that.data.showbookingStatus.push(that.data.bookingStatus)
    //   }
    // }, this) 
    // console.log(that.data.showbookingStatus)
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})